package practise.alogrithm.hundredInterviewQuestions.Utils;

/**
 * Created by richard on 6/2/14.
 */
public class LinkedListBuilder {
    public static ListNode buildLinkedListFromArray(int[] number){
        ListNode listNode = new ListNode();
        ListNode head = new ListNode();
        head= listNode;
        for(int i =0; i<number.length;i++){
            listNode.setValue(number[i]);
            listNode.setNext(new ListNode());
            listNode = listNode.getNext();
        }
        return head;
    }

    public static void swap(int[] array, int target, int source){
        int temp =array[target];
        array[target]=array[source];
        array[source]=temp;
    }
}
